<?
	require('common.php');
	// Increment the numClicks field for the selected
	// banner and then redirect the user to the appropriate
	// link, depending on whether they clicked on the top/bottom
	// banner.
	// Increment the number of clicks
	@mysql_query("update banners set numClicks = numClicks + 1 where id = " . $_GET['id']);
	
	// Get the link for the top banner
	$result = @mysql_query("select html from banners where id=".$_GET['id']);
	if($row = mysql_fetch_object($result)){
		$link = $row->html;
		if ( strstr($link,"http:") ){
		}else{
			$link = "http://$link";
		}
		header("Location: " . $link);
	}
?>